/*
 * CloudStego school project
 * @author lauris kruusamae
 * @author triin uudam
 * @author uku loskit
 */
package main;

/**
 * Data holder for bytes values with indices.
 * Index is used for sorting of these byte values
 *
 */
public class Byte implements Comparable<Byte> {

	private long index;
	private byte value;
	
	public Byte(long index, byte value) {
		super();
		this.index = index;
		this.value = value;
	}
	
	public long getIndex() {
		return index;
	}

	public byte getValue() {
		return value;
	}

	public String toString() {
		return String.format("%d,%s", index, value);
	}
	
	@Override
    public int compareTo(Byte another) {
        long anotherIndex = another.getIndex();
        long thisIndex = this.getIndex();
        if (anotherIndex < thisIndex) {
            return 1;
        } else if (anotherIndex > thisIndex) {
            return -1;
        } else {
            return 0;
        }
    }
}
